"""
    Author:
    Date: 2018-11-04

    常量定义
"""

# -------------------------------------------------------------------------
# 宝石类型
# -------------------------------------------------------------------------

GEM_OF_RED                                      = 1  # 红宝石
GEM_OF_GREEN                                    = 2  # 绿宝石


# -------------------------------------------------------------------------
# BANNER 类型
# -------------------------------------------------------------------------

BANNER_OF_HOME                                  = 1  # 首页banner
BANNER_OF_ROOMS                                 = 2  # 聊天室banner
BANNER_OF_CUSTOM_DECORATION                     = 3  # 个性装扮banner

# -------------------------------------------------------------------------
# 动态类型
# -------------------------------------------------------------------------

MOMENT_PHOTO                                    = 1  # 图片动态
MOMENT_VIDEO                                    = 2  # 视频动态

# -------------------------------------------------------------------------
# 视频审核状态
# -------------------------------------------------------------------------

VIDEO_AUTH_STATUS_WAITING                       = 1  # 待审
VIDEO_AUTH_STATUS_REJECT                        = 2  # 拒绝
VIDEO_AUTH_STATUS_AGREE                         = 3  # 同意


# -------------------------------------------------------------------------
# 照片审核状态
# -------------------------------------------------------------------------

PHOTO_AUTH_STATUS_WAITING                       = 1  # 待审
PHOTO_AUTH_STATUS_REJECT                        = 2  # 拒绝
PHOTO_AUTH_STATUS_AGREE                         = 3  # 同意

# -------------------------------------------------------------------------
# 资料审核状态
# -------------------------------------------------------------------------

PROFILE_AUTH_STATUS_WAITING                       = 1  # 待审
PROFILE_AUTH_STATUS_REJECT                        = 2  # 拒绝
PROFILE_AUTH_STATUS_AGREE                         = 3  # 同意


# -------------------------------------------------------------------------
# 代理等级定义
# -------------------------------------------------------------------------

AGENT_LEVEL_GENERAL_AGENT                       = 1  # 总代
AGENT_LEVEL_AGENT                               = 2  # 二级代理


# -------------------------------------------------------------------------
# 微信公众号用户标签
# -------------------------------------------------------------------------

WXTAG_ADMIN                                     = 100  # 管理员: admin
WXTAG_TEST_ACCOUNT                              = 101  # 测试账号: test_account
WXTAG_GENERAL_AGENT                             = 102  # 总代: ga
WXTAG_AGENT                                     = 103  # 代理: agent

# -------------------------------------------------------------------------
# 审核状态定义
# -------------------------------------------------------------------------

AUTH_STATUS_NONE                                = 0  # 未提交审核
AUTH_STATUS_WAITING                             = 1  # 审核中
AUTH_STATUS_REJECTED                            = 2  # 审核失败
AUTH_STATUS_CERTIFIED                           = 3  # 审核通过

# -------------------------------------------------------------------------
# 红包发送状态
# -------------------------------------------------------------------------

RED_PACK_STATUS_NONE                            = 0  # 未发送
RED_PACK_STATUS_SENDING                         = 1  # 发送中
RED_PACK_STATUS_FAILED                          = 2  # 失败
RED_PACK_STATUS_SUCCESS                         = 3  # 成功

# -------------------------------------------------------------------------
# 消费类型定义
# -------------------------------------------------------------------------

DIAMOND_INPUT_CHARGE                            = 1  # 充值
DIAMOND_INPUT_ACTIVITY_AGENT_INVITE_USER        = 6  # 代理邀请用户
DIAMOND_INPUT_ACTIVITY_BE_INVITED_BY_AGENT      = 7  # 接受代理的邀请
DIAMOND_INPUT_ACTIVITY_BE_INVITED_BY_PARTNER    = 8  # 接受合伙人的邀请
DIAMOND_INPUT_ACTIVITY_FREE_TRIAL               = 9  # 免费试用活动赠送的钻石
DIAMOND_INPUT_REFUND                            = 10  # 退款
DIAMOND_INPUT_ADMIN                             = 98  # GM充值
DIAMOND_INPUT_TESTING                           = 99  # 测试收入

DIAMOND_OUTPUT_BUY_VIDEO                        = 102  # 购买短视频
DIAMOND_OUTPUT_VIDEO_CHAT                       = 103  # 和主播视频电话
DIAMOND_OUTPUT_SEND_GIFT                        = 104  # 赠送礼物
DIAMOND_OUTPUT_SEND_MESSAGE                     = 105  # 给主播发送私信
DIAMOND_OUTPUT_BUY_VIP_CARD                     = 106  # 购买vip卡片
DIAMOND_OUTPUT_TESTING                          = 199  # 测试支出

TICKET_INPUT_SELL_VIDEO                         = 1002  # 出售短视频
TICKET_INPUT_VIDEO_CHAT                         = 1003  # 和观众视频电话
TICKET_INPUT_RECEIVE_GIFT                       = 1004  # 收到礼物
TICKET_INPUT_RECEIVE_MESSAGE                    = 1005  # 收到私信
TICKET_INPUT_FREE_CHAT                          = 1006  # 免费通话

TICKET_OUTPUT_REFUND                            = 1110  # 退款

DEVKEEP_COIN_OUTPUT_BUY_VIDEO                   = 202  # 购买短视频
DEVKEEP_COIN_OUTPUT_VIDEO_CHAT                  = 203  # 和主播视频电话
DEVKEEP_COIN_OUTPUT_SEND_GIFT                   = 204  # 赠送礼物
DEVKEEP_COIN_OUTPUT_SEND_MESSAGE                = 205  # 给主播发送私信

DEVKEEP_TICKET_INPUT_SELL_VIDEO                 = 2002  # 出售短视频
DEVKEEP_TICKET_INPUT_VIDEO_CHAT                 = 2003  # 和观众视频电话
DEVKEEP_TICKET_INPUT_RECEIVE_GIFT               = 2004  # 收到礼物
DEVKEEP_TICKET_INPUT_RECEIVE_MESSAGE            = 2005  # 收到私信

# -------------------------------------------------------------------------
# 通话状态类型定义
# -------------------------------------------------------------------------

CALL_STATUS_NONE                                = 0  # 未接听
CALL_STATUS_CALLING                             = 1  # 通话中
CALL_STATUS_DECLINE                             = 2  # 被呼叫人拒绝通话
CALL_STATUS_CANCEL                              = 3  # 发起人取消
CALL_STATUS_END                                 = 4  # 通话结束
CALL_STATUS_SHUTDOWN                            = 5  # 系统关闭


# -------------------------------------------------------------------------
# 主题类型定义
# -------------------------------------------------------------------------

SUBJECT_NU_AND_ONLINE_CASTER_COUNT              = 1  # 主播在线数量(分析和新增用户的关系)
SUBJECT_NU_AND_CALL_COUNT                       = 2  # 通话次数(分析和新增用户的关系)


# -------------------------------------------------------------------------
# 支付类型定义
# -------------------------------------------------------------------------

PAY_TYPE_ALI                                    = 1  # 支付宝
PAY_TYPE_WECHAT                                 = 2  # 微信
PAY_TYPE_APPLE                                  = 3  # 苹果
PAY_TYPE_ALIF2F_QR                              = 4  # 支付宝扫码
PAY_TYPE_WECHAT_QR                              = 5  # 微信扫码
PAY_TYPE_WECHAT_MP                              = 6  # 微信公众平台
PAY_TYPE_ALI_WAP                                = 7  # 支付宝手机网站
PAY_TYPE_HSQ_MP                                 = 8  # 慧收钱微信公众平台


# -------------------------------------------------------------------------
# 用户群体定义
# -------------------------------------------------------------------------

USER_CATEGORY_NONE                              = 0  # 单个用户
USER_CATEGORY_ALL_USERS                         = 1  # 所有用户
USER_CATEGORY_ALL_PREMIUM_USERS                 = 2  # 所有付费用户
USER_CATEGORY_ALL_CASTERS                       = 3  # 所有主播
USER_CATEGORY_ALL_ONLINE_CASTERS                = 4  # 所有在线主播
USER_CATEGORY_TEST_USERS                        = 5  # 测试用户

# -------------------------------------------------------------------------
# 排行榜类型定义
# -------------------------------------------------------------------------

RANKING_DROP_CALL                               = 1  # 漏接电话

# -------------------------------------------------------------------------
# 代理奖励类型定义
# -------------------------------------------------------------------------

AGENT_REWARD_CONSUME                            = 0  # 招募用户充值
AGENT_REWARD_RECRUIT                            = 1  # 招募新人
AGENT_REWARD_INCOME                             = 2  # 招募用户收益

# -------------------------------------------------------------------------
# 过滤类型定义
# -------------------------------------------------------------------------

STERILIZE_NONE                                  = 0  # 不处理
STERILIZE_WORK_TIME                             = 1  # 工作时间
STERILIZE_WHOLE_DAY                             = 2  # 全天

# -------------------------------------------------------------------------
# VIP类型定义
# -------------------------------------------------------------------------

VIP_CARD_WEEKLY                                 = 1  # 周卡
VIP_CARD_MONTHLY                                = 2  # 月卡
VIP_CARD_QUARTERLY                              = 3  # 季卡
VIP_CARD_LIFELONG                               = 4  # 终身卡

# -------------------------------------------------------------------------
# AB测试分组定义
# -------------------------------------------------------------------------

TEAM_A                                          = 1  # A队
TEAM_B                                          = 2  # B队
TEAM_C                                          = 3  # C队
TEAM_D                                          = 4  # D队


# -------------------------------------------------------------------------
# 渠道定义
# -------------------------------------------------------------------------



# -------------------------------------------------------------------------
# 辅助函数
# -------------------------------------------------------------------------


def get_consumption_type_desp(consumption_type):
    """ 获取消费类型的描述 """
    data = {
        DIAMOND_INPUT_CHARGE: '充值',
        DIAMOND_INPUT_ACTIVITY_AGENT_INVITE_USER: '代理邀请用户',
        DIAMOND_INPUT_ACTIVITY_BE_INVITED_BY_AGENT: '接受代理的邀请',
        DIAMOND_INPUT_ACTIVITY_BE_INVITED_BY_PARTNER: '接受合伙人的邀请',
        DIAMOND_INPUT_ACTIVITY_FREE_TRIAL: '免费试用活动赠送的钻石',
        DIAMOND_INPUT_REFUND: '通话退款',
        DIAMOND_INPUT_ADMIN: 'GM充值',
        DIAMOND_INPUT_TESTING: '测试收入',

        DIAMOND_OUTPUT_BUY_VIDEO: '购买短视频',
        DIAMOND_OUTPUT_VIDEO_CHAT: '视频通话',
        DIAMOND_OUTPUT_SEND_GIFT: '赠送礼物',
        DIAMOND_OUTPUT_SEND_MESSAGE: '发送私信',
        DIAMOND_OUTPUT_TESTING: '测试支出',

        TICKET_INPUT_SELL_VIDEO:  '出售短视频',
        TICKET_INPUT_VIDEO_CHAT: '视频通话',
        TICKET_INPUT_RECEIVE_GIFT:  '收到礼物',
        TICKET_INPUT_RECEIVE_MESSAGE: '收到私信',
        TICKET_INPUT_FREE_CHAT: '免费通话',

        TICKET_OUTPUT_REFUND: '通话退款',
    }
    return data.get(consumption_type, str(consumption_type))


def get_recharge_type_desp(recharge_type):
    """ 获取支付类型的说明 """
    data = {
        PAY_TYPE_ALI: '支付宝',
        PAY_TYPE_WECHAT: '微信',
        PAY_TYPE_APPLE: '苹果',
        PAY_TYPE_ALIF2F_QR: '支付宝扫码',
        PAY_TYPE_WECHAT_QR: '微信扫码',
        PAY_TYPE_WECHAT_MP: '微信公众平台',
        PAY_TYPE_ALI_WAP: '支付宝手机网站',
        PAY_TYPE_HSQ_MP: '微信公众平台(HSQ)'
    }
    return data.get(recharge_type, str(recharge_type))


def get_red_pack_status_desp(status):
    """ 获取红包状态的说明 """
    data = {
        RED_PACK_STATUS_NONE:  '未发送',
        RED_PACK_STATUS_SENDING: '发送中',
        RED_PACK_STATUS_FAILED: '发送失败',
        RED_PACK_STATUS_SUCCESS: '发送成功',
    }
    return data.get(status, str(status))


def get_auth_status_desp(status):
    """ 获取审核状态的说明 """
    data = {
        AUTH_STATUS_NONE:  '未提交审核',
        AUTH_STATUS_WAITING: '审核中',
        AUTH_STATUS_REJECTED: '拒绝',
        AUTH_STATUS_CERTIFIED: '通过',
    }
    return data.get(status, str(status))


def get_user_category_desp(category):
    """ 获取审核状态的说明 """
    data = {
        USER_CATEGORY_NONE: '单个用户',
        USER_CATEGORY_ALL_USERS: '所有用户',
        USER_CATEGORY_ALL_PREMIUM_USERS: '所有付费用户',
        USER_CATEGORY_ALL_CASTERS: '所有主播',
        USER_CATEGORY_ALL_ONLINE_CASTERS: '所有在线主播',
        USER_CATEGORY_TEST_USERS: '所有测试用户',
    }
    return data.get(category, str(category))


def get_vip_card_desp(card):
    """ 获取vip卡片的说明 """
    data = {
        VIP_CARD_WEEKLY: '周卡',
        VIP_CARD_MONTHLY: '月卡',
        VIP_CARD_QUARTERLY: '季卡',
        VIP_CARD_LIFELONG: '终身卡',
    }
    return data.get(card, str(card))


def get_vip_card_time(card):
    data = {
        VIP_CARD_WEEKLY: 7*24*3600,
        VIP_CARD_MONTHLY: 31*24*3600,
        VIP_CARD_QUARTERLY: 3*31*24*3600,
        VIP_CARD_LIFELONG: 10*365*24*3600,
    }
    return data.get(card, str(card))


def get_channel_info(channel):
    """ 获取渠道信息 """
    data = {
        'oppo':          {'name': 'OPPO', 'icon': '/static/img/logos/oppo.png'},
        'vivo':          {'name': 'VIVO', 'icon': '/static/img/logos/vivo.png'},
        'huawei':        {'name': '华为', 'icon': '/static/img/logos/huawei.png'},
        'huawei_cuke':   {'name': '华为', 'icon': '/static/img/logos/huawei.png'},
        'qq':            {'name': '应用宝', 'icon': '/static/img/logos/yyb.png'},
        'samsung':       {'name': '三星', 'icon': '/static/img/logos/samsung.png'},
        'sumsong':       {'name': '三星', 'icon': '/static/img/logos/samsung.png'},
        'devkeep':       {'name': '邸客', 'icon': '/static/img/logos/devkeep.png'},
        'huanlejiao':    {'name': '欢乐椒', 'icon': '/static/img/logos/huanlejiao.png'},

        'ios_quyue':     {'name': '苹果', 'icon': '/static/img/logos/apple.png'},
        'ios_xiangjiao': {'name': '苹果', 'icon': '/static/img/logos/apple.png'},
        'ios_kuaimao':   {'name': '苹果', 'icon': '/static/img/logos/apple.png'},
        'ios_yuejian':   {'name': '苹果', 'icon': '/static/img/logos/apple.png'},
    }

    default_channel_info = {'name': channel, 'icon': '/static/img/logos/android.png'}
    info = data.get(channel.lower(), default_channel_info)
    info['code'] = channel
    return info


def get_app_info(app):
    """ 获取APP信息 """
    data = {
        'haibao':       {'name': 'YYZB', },
    }

    info = data.get(app, {})
    info['code'] = app
    return info
